<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>客服自动回复</title>
<link rel="stylesheet" href="dist/botui.min.css" />
<link rel="stylesheet" href="dist/botui-theme-default.css" />
</head>
<body>
<div class="botui-app-container" id="home-demo">
  <bot-ui></bot-ui>
</div>
<script src="https://www.jq22.com/jquery/vue.min.js"></script> 
<script src="dist/botui.min.js"></script> 
<script type="text/javascript">
	// http://wss.miracleendless.com:5500/vuezdhf/index.html   http://wss.miracleendless.com:5500/houseingDetails.html
		var homeBot = BotUI('home-demo');

		homeBot.message.add({
		  content: '欢迎进入宏烨找房 你好 我是宏烨找房的客服 ！'
		}).then(function () {
		  return homeBot.message.add({
		    delay: 1500,
		    content: '请问您有什么问题？'
		  });
		}).then(function () {
		  return homeBot.action.button({
		    delay: 1000,
		    action: [{
		      text: '这房子怎么说!',
		      value: 'sure'
		    }, {
		      text: '价格可以谈谈吗😒',
		      value: 'skip'
		    }]
		  });
		}).then(function (res) {
		  if(res.value == 'sure') {
		    tutorial();
		  }
		  if(res.value == 'skip') {
		    end();
		  }
		});

		var tutorial = function () {
		  homeBot.message.add({
		    delay: 1000,
		    content: "ok，来吧，让问题砸懵我。"
		  }).then(function () {
		    return homeBot.message.add({
		      delay: 1000,
		      content: '请你说一些简单的问题'
		    });
		  }).then(function () {
		    return homeBot.message.add({
		      delay: 1200,
		      content: '太难的问题我可答不出来哈，给你打好预防针了（填写后按回车键）'
		    });
		  }).then(function () {
		    return homeBot.action.text({
		      delay: 800,
		      action: {
		        value: 'come on 来吧，宝贝',
		        placeholder: '麻冷儿写问题吧'
		      }
		    });
		  }).then(function (res) {
		    return homeBot.message.bot({
		      delay: 500,
		      content: res.value + ' 真是个好问题！'
		    });
		  }).then(function (res) {
		    return homeBot.message.bot({
		      delay: 1400,
		      content: '很好，我不会，你可以去别的地儿问了，例如：'
		    });
		  }).then(function (res) {
		    return homeBot.message.add({
		      delay: 1200,
		      type: 'embed',
		      content: 'https://www.baidu.com//'
		    });
		  }).then(function (res) {
		    return homeBot.message.bot({
		      delay: 2500,
		      content: '好了，你可以问度娘了，找到答案，别忘告诉我哈'
		    });
		  }).then(function (res) {
		    return homeBot.message.bot({
		      delay: 1000,
		      content: '别忘记，告，诉，我。'
		    });
		  }).then(end);
		};

		var end = function () {
		  homeBot.message.add({
		    delay: 9000,
		    content: '实在不行...我还是给您一个联系方式，您自己和他谈吧  110 还有 120   自己去问吧！' 
		  }) 
		};


	</script>
</body>
</html>